<?php
/**
 * 城市
 */
namespace App\Http\Controllers;

use App\Service\CityService;
use App\Validation\CitySearchValidation;

use App\Service\DicsService;

class CityController extends BaseController
{
	/**
	 * [searchAction 城市搜索]
	 * @return [type] [description]
	 */
	public function searchAction()
	{
		$raw = $this->validation(new CitySearchValidation, $this->request->getJsonRawBody());
		$data = DicsService::getGroup($raw);
		$assign = [
			'list'  => $data,
		];

		return $this->echoJson($assign);
	}
    
    //城市全部2级树
	public function allAction()
	{
		//$raw = $this->validation(new CitySearchValidation, $this->request->getJsonRawBody());
		$data = DicsService::getAllCtiy();
		return $this->echoJson($data);
	}    

	/**
	 * [groupAction 分组]
	 * @return [type] [description]
	 */
	public function groupAction()
	{
		$raw = $this->validation(new CitySearchValidation, $this->request->getJsonRawBody());
		$data = DicsService::getGroup($raw);

		$assign = [
			'list'  => $data
		];

		return $this->echoJson($assign);
	}
}